package khleuven.mondzorg.db.readers;

import android.content.Context;
import khleuven.mondzorg.db.DBException;
import khleuven.mondzorg.db.Datasource;
import khleuven.mondzorg.db.googlespreadsheet.GoogleSpreadSheet;

public class EntryBuilderOnline extends EntryBuilder {
	
	private Datasource ds;
	
	protected EntryBuilderOnline(Context applicationContext) throws DBException{
		super();
		
		initialiseDataSource(applicationContext);
	}
	
	private void initialiseDataSource(Context applicationContext) throws DBException {
		if(ds == null){
			ds = new GoogleSpreadSheet(this, applicationContext);
		}
	}

	@Override
	protected void reloadAllIllustrationsFromSource() throws DBException {
		ds.reloadAllIllustrationsFromSource();
	}

	@Override
	protected void reloadAllEntriesFromSource() throws DBException {
		ds.reloadAllEntriesFromSource();
	}

}
